/**
 * @file argsParser.h
 * @author SDK_TEAM
 * @brief
 * @version 0.1
 * @date 2022-10-26
 *
 * Copyright:
 * © 2018 北京灵汐科技有限公司 版权所有。
 * 注意：以下内容均为北京灵汐科技有限公司原创，未经本公司允许，不得转载，否则将视为侵权；对于不遵守此声明或者其他违法使用以下内容者，本公司依法保留追究权。
 * © 2018 Lynxi Technologies Co., Ltd. All rights reserved.
 * NOTICE: All information contained here is, and remains the property of Lynxi.
 * This file can not be copied or distributed without the permission of Lynxi
 * Technologies Co., Ltd.
 *
 */
#pragma once

#include "util.hpp"
#include "CLI/CLI11.hpp"
#include <iostream>
#include <string>

namespace ArgsParse
{

  static std::string argDetModelPath; // 模型路径
  static std::string argClsModelPath; // 模型路径
  static std::string argRecModelPath; // 模型路径
  static std::string argKeysFilePath; // Keys文件路径

  bool argsParser(int argc, char *argv[])
  {
    CLI::App app;

    std::string argChips;

    app.add_option("input_image", argInputFilePath, "input jpeg file path")->default_val("../data/pp_ocr_sample/ocr_sample.jpeg");
    app.add_option("--m1,--detectModelPath", argDetModelPath, "detect model path")->default_val("../model/paddleOCRv3_det_b1_h736_w1280_c3_iuint8_ofloat16_0000/Net_0");
    app.add_option("-p,--detectPostPlugPath", argPostPluginPath, "detect post process plugin path")->default_val("../common/plugin/postprocess/cross_compiled_lib/libPPOcrDetectPlugin.so");
    app.add_option("--m2,--clsModelPath", argClsModelPath, "cls ocr model path")->default_val("../model/paddleOCR_cls_b1_h48_w320_c3_iuint8_ofloat16_0000/Net_0");
    app.add_option("--m3,--recModelPath", argRecModelPath, "rec ocr model path")->default_val("../model/paddleOCRv3_rec_b1_h48_w320_c3_iuint8_ofloat16_0000/Net_0");
    app.add_option("-k,--keysFilePath", argKeysFilePath, "ppocr keys file path")->default_val("../data/pp_ocr_sample/ppocr_keys_v1.txt");
    app.add_option("-o,--osdPlugPath", argOsdPluginPath, "osd plugin path")->default_val("../common/plugin/osd/lib/libOsdPlugin.so");
    app.add_option("-d,--device_id", argChips, "test device number which can be 0~N-1 (N is device count), eg.:0,1,2")->default_val("0");

    CLI11_PARSE(app, argc, argv);

    if (!setChips(argChips.c_str(), ','))
    {
      return false;
    }

    return true;
  }

} // namespace ArgsParse
